home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / comm / ums / developer.lha / Developer / interfaces / Modula-2 / UmsD.def < prev    next >
Encoding:
Modula Definition  |  1993-10-31  |  16.5 KB  |  448 lines

  1. (* --------------------------------------------------------------------------
  2.   :Program.       ums
  3.   :Contents.      Interfaces for ums.library
  4.   :Author.        Martin Koyro [mk]
  5.   :Address.       SnailMail:                EMail:
  6.   :Address.       Salzmannstr. 12           MAUS: MS3
  7.   :Address.       48147 Muenster            INET: mk@ms3.ms.open.de
  8.   :Address.       GERMANY
  9.   :Author.        Martin Loos [ml]
  10.   :Address.       SnailMail:                EMail:
  11.   :Address.       Im Scheidt 25             MAUS: UN
  12.   :Address.       58640 Iserlohn-Kalthof    INET: mattin@unicorn.mk.open.de
  13.   :Address.       GERMANY                   FIDO: 2:243/4624.2 (GCC)
  14.   :Author.        Kai Bolay [kb]
  15.   :Address.       SnailMail:                EMail:
  16.   :Address.       Hoffmannstraße 168        FIDO: 2:2407/106.3 (Classic)
  17.   :Address.       71229 Leonberg            UUCP: kai@amokle.stgt.sub.org
  18.   :Author.        Martin Horneffer [mh]
  19.   :Address.       MAUS:   AC2
  20.   :Address.       FIDO:   2:242/7.9 (Classic)
  21.   :Address.       USENET: mh@umshq.dfv.rwth.aachen.de
  22.   :Address.       ADSP:   mh@umshq.adsp.sub.org
  23.   :History.       [ml] 19-Jan-93: Conversion from Oberon to Modula-2
  24.   :History.       [kb] 28-Mar-93: New Consts added
  25.   :History.       [ml] 20-May-93: New Consts and Tags added
  26.   :History.       [mh]  2-Jun-93: changed and added some Consts
  27.   :History.       [mh] 29-Jun-93: added some Consts
  28.   :History.       [mh] 26-Aug-93: added tagHide
  29.   :History.       [mk] 24-Okt-93: Setstructure revised
  30.   :Language.      Modula II
  31.   :Translator.    M2Amiga V4.107d
  32. -------------------------------------------------------------------------- *)
  33.  
  34. DEFINITION MODULE UmsD;
  35. (*$ Implementation:=FALSE LargeVars:=FALSE *)
  36.  
  37.  
  38. IMPORT u:UtilityD,s:SYSTEM;
  39.  
  40.  
  41. TYPE
  42.     NUM             = LONGINT;
  43.  
  44.     (* user status-bits *)
  45.  
  46.     UserStatusFlags      = (us0,us1,us2,us3,
  47.       archive,      (* msg should be archived, don't delete *)
  48.       junk,         (* negative selection, inheritance suggested *)
  49.       postPoned,    (* to be read again, (but not now) *)
  50.       selected,     (* positive selection, inheritance suggested *)
  51.       Old,          (* user has already read this Message *)
  52.       WriteAccess,  (* user may change or delete this message *)
  53.       ReadAccess,   (* user may read this message *)
  54.       ViewAccess,   (* user may read the header of this message *)
  55.       Owner,        (* user 'owns' (wrote) this message *)
  56.       us13,us14,
  57.       filtered,     (* msg has been processed by filter,
  58.                        'selected' and 'junk' have been properly set *)
  59.       us16,us17,us18,us19,us20,us21,us22,us23,
  60.       us24,us25,us26,us27,us28,us29,us30,us31);
  61.  
  62.     UserStatusFlagSet    = SET OF UserStatusFlags;
  63.  
  64.  
  65.     (* global status-bits *)
  66.  
  67.     GlobalStatusFlags    = (
  68.       Deleted,      (* msg is really deleted *)
  69.       Expired,      (* msg has expired and may be deleted *)
  70.       Exported,     (* msg has been exported *)
  71.       Orphan,       (* msg could not be exported *)
  72.       Link,         (* within a ring of linked msgs *)
  73.       HardLink,     (* link is hardLink *)
  74.  
  75.       gs6,gs7,gs8,gs9,gs10,gs11,gs12,gs13,gs14,gs15,gs16,gs17,gs18,gs19,
  76.       gs20,gs21,gs22,gs23,gs24,gs25,gs26,gs27,gs28,gs29,gs30,gs31);
  77.  
  78.     GlobalStatusFlagSet  = SET OF GlobalStatusFlags;
  79.  
  80.  
  81.  
  82. CONST
  83.     umsName               = "ums.library";
  84.     MaxMsgs               = MAX(NUM);
  85.     NumFields             = 128;
  86.  
  87.     ProtectedUserFlags    = UserStatusFlagSet{WriteAccess,ReadAccess,
  88.                                               ViewAccess,Owner};
  89.     ProtectedGlobalFlags  = GlobalStatusFlagSet{Deleted,Exported,Orphan,
  90.                                                 Link,HardLink};
  91.     Read                  = UserStatusFlagSet{Old};
  92.  
  93.  
  94.  
  95. TYPE
  96.     STRPTR          = POINTER TO ARRAY[0..MAX(NUM) - 2] OF CHAR;
  97.  
  98.     oldMsg          = ARRAY[0..15] OF STRPTR;
  99.     oldMsgPtr       = POINTER TO oldMsg;
  100.  
  101.     MsgTextFields   = ARRAY[0..NumFields - 1] OF STRPTR;
  102.     MessageInfo     = RECORD
  103.                         hdrLen      : LONGINT;
  104.                         txtLen      : LONGINT;
  105.                         date        : LONGINT;
  106.                         up, dn,
  107.                         lt, rt      : LONGINT;
  108.                         globalStat  : GlobalStatusFlagSet;
  109.                         userStat    : UserStatusFlagSet;
  110.                         loginStat   : s.LONGSET;
  111.                         hardLink    : LONGINT;
  112.                         softLink    : LONGINT;
  113.                     END; (*of RECORD*)
  114.  
  115.  
  116. CONST
  117.  
  118.    (* enumeration of fields in an UMS-message *)
  119.  
  120.    msgText      =  0;
  121.    fromName     =  1;
  122.    fromAddr     =  2;
  123.    toName       =  3;
  124.    toAddr       =  4;
  125.    msgID        =  5;
  126.    creationDate =  6;
  127.    receiveDate  =  7;
  128.    refID        =  8;
  129.    group        =  9;
  130.    subject      = 10;
  131.    attributes   = 11;
  132.    comments     = 12;
  133.    organization = 13;
  134.    distribution = 14;
  135.    folder       = 15;
  136.    fidoID       = 16;
  137.    mausID       = 17;
  138.    replyGroup   = 18;
  139.    replyName    = 19;
  140.    replyAddr    = 20;
  141.    fidoText     = 32;
  142.    errorText    = 33;
  143.    newsreader   = 34;
  144.  
  145.  
  146. (*** Errors ***)
  147.  
  148. CONST
  149.   ok                =  0;
  150.   unknown           =  1;
  151.  
  152.   codeMissing       = 100;
  153.   forbiddenCode     = 101;
  154.   noWriteAccess     = 102;
  155.   noReader          = 103;
  156.   noExporter        = 104;
  157.   badLink           = 105;
  158.   noWork            = 106;
  159.   noSysop           = 107;
  160.   badChange         = 108;
  161.  
  162.   dupe              = 200;
  163.   noReadAccess      = 201;
  164.   noViewAccess      = 202;
  165.   msgCorrupted      = 203;
  166.   noHdrSpace        = 204;
  167.   noSuchMsg         = 205;
  168.   badName           = 206;
  169.   badTag            = 207;
  170.   missingTag        = 208;
  171.   noSuchUser        = 209;
  172.   notFound          = 210;
  173.   autoBounce        = 211;
  174.   msgDeleted        = 212;
  175.   noNetAccess       = 213;
  176.   badPattern        = 214;
  177.   badVarname        = 215;
  178.   fsFull            = 216;
  179.   noMsgMem          = 217;
  180.   missingIndex      = 218;
  181.  
  182.   serverTerminated  = 300;
  183.   cantWrite         = 301;
  184.   cantRead          = 302;
  185.   wrongMsgPtr       = 303;
  186.   serverNotFree     = 304;
  187.   idCountProb       = 305;
  188.   noLogin           = 306;
  189.   wrongServer       = 307;
  190.   noMem             = 308;
  191.  
  192.  
  193.   (* tag-values *)
  194.  
  195.   typeSTRPTR        = 2000H;
  196.   typeVARPAR        = 4000H;
  197.  
  198.  
  199.   (** tags for WriteUMSMsg() **)
  200.  
  201.   (*  add 'typeVARPAR' for ReadUMSMsg()  *)
  202.   (*  no 'typeVARPAR' for WriteUMSMsg()  *)
  203.  
  204.   tagMsgNum         =  1 + u.tagUser;
  205.  
  206.   tagMsgDate        =  4 + u.tagUser;
  207.                            (* don't usually use when writing!      *)
  208.                            (* Using tagMsgDate with WriteUMSMsg()  *)
  209.                            (* has a very special meaning.          *)
  210.   tagChainUp        =  7 + u.tagUser;
  211.   tagHardLink       = 14 + u.tagUser;
  212.   tagSoftLink       = 15 + u.tagUser;
  213.  
  214.   tagAutoBounce     = 65 + u.tagUser;
  215.                            (* when writing:                                *)
  216.                            (* data # 0: server returns error 'autoBounce', *)
  217.                            (*           but still keeps the Msg and sends  *)
  218.                            (*           it to the sysops.                  *)
  219.   tagHdrFill        = 66 + u.tagUser;
  220.                            (* when writing: how much bytes to be reserved  *)
  221.   tagTxtFill        = 67 + u.tagUser;
  222.                            (*               for header and text            *)
  223.   tagNoUpdate       = 69 + u.tagUser;
  224.                            (* data = 0: (default) set 'Old'-Flag when      *)
  225.                            (*           reading or writing                 *)
  226.                            (* data = 1: don't touch 'Old'-Flag             *)
  227.   tagHide           = 70 + u.tagUser;
  228.                            (* for writing:                                 *)
  229.                            (* data = 0: default                            *)
  230.                            (* data = 1: msg only accessible by exporters   *)
  231.                            (* data = 2: msg only accessible by users       *)
  232.  
  233.   tagMsgText        = 256 + typeSTRPTR;
  234.   tagFromName       = tagMsgText + 1;
  235.   tagFromAddr       = tagMsgText + 2;
  236.   tagToName         = tagMsgText + 3;
  237.   tagToAddr         = tagMsgText + 4;
  238.   tagMsgID          = tagMsgText + 5;
  239.   tagCreationDate   = tagMsgText + 6;
  240.   tagReceiveDate    = tagMsgText + 7;
  241.   tagRefID          = tagMsgText + 8;
  242.   tagGroup          = tagMsgText + 9;
  243.   tagSubject        = tagMsgText +10;
  244.   tagAttributes     = tagMsgText +11;
  245.   tagComments       = tagMsgText +12;
  246.   tagOrganisation   = tagMsgText +13;
  247.   tagDistribution   = tagMsgText +14;
  248.   tagFolder         = tagMsgText +15;
  249.   tagFidoId         = tagMsgText +16;
  250.   tagMausID         = tagMsgText +17;
  251.   tagReplyGroup     = tagMsgText +18;
  252.   tagReplyName      = tagMsgText +19;
  253.   tagReplyAddr      = tagMsgText +20;
  254.   tagFidoText       = tagMsgText +32;
  255.   tagErrorText      = tagMsgText +33;
  256.   tagNewsreader     = tagMsgText +34;
  257.  
  258.  (* tagMsgText+15 .. tagMsgText+127 are also usable as text-fields *)
  259.  
  260.   tagTextFields     = 513 + u.tagUser;
  261.                             (* datatype: POINTER TO MsgTextFields *)
  262.  
  263.  
  264.   (** tags for ReadUMSMsg() **)
  265.  
  266.   (*  add 'typeVARPAR' for ReadUMSMsg()  *)
  267.   (*  no 'typeVARPAR' for WriteUMSMsg()  *)
  268.  
  269.   tagRMsgNum        =  1 + u.tagUser;
  270.  
  271.   tagRHdrLength     =  2 + u.tagUser + typeVARPAR;
  272.   tagRTxtLength     =  3 + u.tagUser + typeVARPAR;
  273.   tagRMsgDate       =  4 + u.tagUser + typeVARPAR;
  274.   tagRChainUp       =  7 + u.tagUser + typeVARPAR;
  275.   tagRChainDn       =  8 + u.tagUser + typeVARPAR;
  276.   tagRChainLt       =  9 + u.tagUser + typeVARPAR;
  277.   tagRChainRt       = 10 + u.tagUser + typeVARPAR;
  278.   tagRGlobalFlags   = 11 + u.tagUser + typeVARPAR;
  279.   tagRUserFlags     = 12 + u.tagUser + typeVARPAR;
  280.   tagRLoginFlags    = 13 + u.tagUser + typeVARPAR;
  281.   tagRHardLink      = 14 + u.tagUser + typeVARPAR;
  282.   tagRSoftLink      = 15 + u.tagUser + typeVARPAR;
  283.  
  284.   tagRDateStyle     = 64 + u.tagUser;
  285.                            (*  style for receiveDate when reading:         *)
  286.                            (* data = 0: no receiveDate                     *)
  287.                            (* data = 1: emulate old-style receiveDate      *)
  288.   tagRIDStyle       = 68 + u.tagUser;
  289.                            (* style for Message-ID                         *)
  290.                            (* data = 0: real Message-ID                    *)
  291.                            (* data = 1: old style dec-number               *)
  292.   tagRNoUpdate      = 69 + u.tagUser;
  293.                            (* data = 0: (default) set 'Old'-Flag when      *)
  294.                            (*           reading or writing                 *)
  295.                            (* data = 1: don't touch 'Old'-Flag             *)
  296.  
  297.   tagRMsgText        =  256 + typeSTRPTR + typeVARPAR + u.tagUser;
  298.   tagRFromName       = tagRMsgText + 1;
  299.   tagRFromAddr       = tagRMsgText + 2;
  300.   tagRToName         = tagRMsgText + 3;
  301.   tagRToAddr         = tagRMsgText + 4;
  302.   tagRMsgID          = tagRMsgText + 5;
  303.   tagRCreationDate   = tagRMsgText + 6;
  304.   tagRReceiveDate    = tagRMsgText + 7;
  305.   tagRRefID          = tagRMsgText + 8;
  306.   tagRGroup          = tagRMsgText + 9;
  307.   tagRSubject        = tagRMsgText +10;
  308.   tagRAttributes     = tagRMsgText +11;
  309.   tagRComments       = tagRMsgText +12;
  310.   tagROrganisation   = tagRMsgText +13;
  311.   tagRDistribution   = tagRMsgText +14;
  312.   tagRFolder         = tagRMsgText +15;
  313.   tagRFidoID         = tagRMsgText +16;
  314.   tagRMausID         = tagRMsgText +17;
  315.   tagRReplyGroup     = tagRMsgText +18;
  316.   tagRReplyName      = tagRMsgText +19;
  317.   tagRReplyAddr      = tagRMsgText +20;
  318.   tagRFidoText       = tagRMsgText +32;
  319.   tagRErrorText      = tagRMsgText +33;
  320.   tagRNewsreader     = tagRMsgText +34;
  321.  
  322.   (* tagRMsgText+15 .. tagRMsgText+127 are also usable as text-fields *)
  323.  
  324.   tagRMsgInfo       = 512 + u.tagUser;
  325.                             (* datatype: POINTER TO MessageInfo *)
  326.   tagRTextFields    = tagRMsgInfo + 1;
  327.                             (* datatype: POINTER TO MsgTextFields *)
  328.  
  329.   tagRReadHeader    = tagRMsgInfo + 2;
  330.                             (* read all header-fields *)
  331.   tagRReadAll       = tagRMsgInfo + 3;
  332.                             (* read all text-fields *)
  333.  
  334.  
  335.   (** tags for UMSSelect()  **)
  336.  
  337.   tagSelSet         = 1024 + u.tagUser;
  338.                              (* flags to set on selected msgs *)
  339.   tagSelUnset       = tagSelSet + 1;
  340.                              (* flags to clear *)
  341.   tagSelWriteGlobal = tagSelSet + 2;
  342.                              (* change global flags, not user-flags *)
  343.   tagSelWriteLocal  = tagSelSet + 3;
  344.                             (* change login-local flags, not user-flags *)
  345.   tagSelWriteUser   = tagSelSet + 4+typeSTRPTR;
  346.                             (* change other user's flags *)
  347.  
  348.   tagSelStart       = tagSelSet + 8;
  349.                             (* process only msgs AFTER this one *)
  350.   tagSelStop        = tagSelSet + 9;
  351.                             (* process only msgs BEFORE this one *)
  352.  
  353.   (* the following are mutual-exclusiv *)
  354.   (*   use only one of the following operations,   *)
  355.   (*   otherwise unpredictable things may happen!  *)
  356.  
  357.   tagSelReadGlobal  = tagSelSet +10;
  358.                             (* examine global flags, not user-flags *)
  359.   tagSelReadLocal   = tagSelSet +11;
  360.                             (* examine login-local flags, not user-flags *)
  361.   tagSelReadUser    = tagSelSet +12+typeSTRPTR;
  362.                             (* examine other user's flags *)
  363.   tagSelMask        = tagSelSet +16;
  364.                             (* select msgs, that's flags    *)
  365.   tagSelMatch       = tagSelSet +17;
  366.                             (*   ANDed with mask equal match *)
  367.   tagSelParent      = tagSelSet +18;
  368.                             (* examine parent's flags *)
  369.  
  370.   tagSelDate        = tagSelSet +19;
  371.                             (* select msgs younger than this date *)
  372.  
  373.   tagSelTree        = tagSelSet +20;
  374.                             (* select whole tree this msg is in *)
  375.  
  376.   tagSelSubTree     = tagSelSet +21;
  377.                             (* select sub-tree this msg is root of *)
  378.  
  379.   tagSelMsg         = tagSelSet +22;
  380.                             (* select a msg specified by number *)
  381.  
  382.   tagSelQuick       = tagSelSet +23;
  383.                             (* quick select enabled *)
  384.   (* tagMsgText .. tagMsgText+127 are also allowed for selecting *)
  385.  
  386.  
  387.   (** tags for UMSSearch() **)
  388.  
  389.   tagSearchLast     = 2048 + u.tagUser;
  390.                              (* number of LAST msg not to search *)
  391.   tagSearchQuick    = tagSearchLast+ 1;
  392.                              (* quick searches enabled *)
  393.  
  394.   tagSearchGlobal   = tagSearchLast+ 2;
  395.                              (* examine global flags instead of user-flags*)
  396.   tagSearchLocal    = tagSearchLast+ 3;
  397.                              (* examine login-local flags, not user-flags *)
  398.   tagSearchUser     = tagSearchLast+ 4+typeSTRPTR;
  399.                              (* examine other user's flags *)
  400.   tagSearchDirection= tagSearchLast+ 5;
  401.                              (* set search direction *)
  402.                              (*  0 = default  *)
  403.                              (*  1 = forward  *)
  404.                              (* -1 = backward *)
  405.   tagSearchPattern  = tagSearchLast + 6;
  406.                              (* string in tagMsgText .. tagMsgText+127 is: *)
  407.                              (* 0: no pattern, just a plain string    *)
  408.                              (* 1: an AmigaDOS style pattern          *)
  409.                              (* 2: a pattern, only if it contains     *)
  410.                              (*    wildcards ('auto-detect patterns') *)
  411.  
  412.   tagSearchMask     = tagSearchLast+16;
  413.                              (* search a msg, that's flags   *)
  414.   tagSearchMatch    = tagSearchLast+17;
  415.                              (*   ANDed with mask equal match *)
  416.  
  417.   (* tagMsgText .. tagMsgText+127 are also allowed for searching *)
  418.  
  419.  
  420.   (**  tags for ReadUMSConfig(), WriteUMSConfig()  **)
  421.  
  422.   tagCfgGlobalOnly  = 3072 + u.tagUser;
  423.                              (* read or write only global config,         *)
  424.                              (* thus must not be combined with tagCfgUser *)
  425.   tagCfgName        = tagCfgGlobalOnly+ 1 + typeSTRPTR;
  426.                              (* name of config var to read or write       *)
  427.   tagCfgUser        = tagCfgGlobalOnly+ 2 + typeSTRPTR;
  428.                              (* name of user to read/write locals from/to *)
  429.  
  430.  
  431.   (**  tags for ReadUMSConfig()  **)
  432.  
  433.   tagCfgUserName    = tagCfgGlobalOnly+ 3 + typeSTRPTR;
  434.                              (* alias to get realname from                *)
  435.   tagCfgNextVar     = tagCfgGlobalOnly+ 4 + typeSTRPTR;
  436.                              (* get name of next var                      *)
  437.  
  438.  
  439.   (**  tags for WriteUMSConfig()  **)
  440.  
  441.   tagCfgDump        = tagCfgGlobalOnly+16 + typeSTRPTR;
  442.                              (* write current settings to a file *)
  443.   tagCfgData        = tagCfgGlobalOnly+17 + typeSTRPTR;
  444.                              (* data to write to specified var   *)
  445.  
  446.  
  447. END UmsD.Lib9
  448.